// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init({
  env: cloud.DYNAMIC_CURRENT_ENV
})

// 云函数入口函数
exports.main = async (event, context) => {
  console.log('test 云函数被调用，参数:', event);
  
  const wxContext = cloud.getWXContext()
  const openid = wxContext.OPENID
  
  console.log('测试云函数 - wxContext:', wxContext)
  console.log('测试云函数 - openid:', openid)
  
  return {
    success: true,
    message: '测试成功',
    openid: openid,
    event: event
  }
} 